<template>
    <Div>
        <div style="background-color: #d9d9d9;font-size: 30px;"><span style="margin-left: 30px;">修改资料</span></div>
        <div>
            <h2>昵称</h2>
            <el-input v-model="userInfo.name" placeholder="" style="width: 200px;"></el-input>

        </div>
        <div style="display: inline">
            <h2>性别</h2>

            <el-input v-model="userInfo.sex" placeholder="" style="width: 200px;"></el-input>
        </div>
        <div>
            <h2>自我介绍</h2>
            <el-input
                    type="textarea"
                    placeholder="请输入内容"
                    v-model="userInfo.myjs"
                    :rows="8"
                    maxlength="150"
                    show-word-limit
            >
            </el-input>
        </div>
        <div>
            <h2>个人描述</h2>
            <el-input
                    type="textarea"
                    placeholder="请输入内容"
                    v-model="userInfo.myms"
                    :rows="8"
                    maxlength="150"
                    show-word-limit
            >
            </el-input>
        </div>
        <div style="margin-left: 150px;margin-top: 50px;margin-bottom: 180px;">
            <el-button @click="updaPut()">提交修改</el-button>
        </div>
    </Div>
</template>

<script>


    export default {
        name: "dat",
        data() {
            return {
                userInfo: {
                    myjs:'',
                    myms:'',
                },
                token: localStorage.getItem('TOKEN'),
                radio: '1',
                text: '',
            }
        },

        created() {
           this.$axios.get("/api/user/main/info", {headers: {TOKEN: this.token}}).then(res => {
                this.userInfo = res.data.data;
            })

        },
        methods: {

            updaPut() {
                this.$axios.post('/api/user/UpdaInfo',this.userInfo).then(res => {
                    console.log(res)
                    if (res.data.status === 1) {
                        this.$message.success(res.data.msg);
                        this.$router.push('/info');
                    } else {
                        this.$message.error(res.data.msg);
                    }
                })
            }





        }
    }
</script>

<style scoped>

</style>